package com.cssl.controller;

import com.cssl.domain.Dtsorder;
import com.cssl.domain.Page;
import com.cssl.domain.dto.*;
import com.cssl.openFeign.DtsorderFeignClient;
import com.cssl.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/Order")
public class DtsorderController {
    @Autowired
    DtsorderFeignClient client;
    /**
     * 订单详情的list
     */
    @PostMapping("/list")
    Result findPageorder(@RequestBody DtsorderDto dtsorderDto){
        return client.findPageorder(dtsorderDto);
    }


    @PostMapping("/addDirectUserOrder")
    @ApiOperation(value = "直购新增订单",notes = "团购,直购")
    public Result addDirectUserOrder(@RequestBody DirectUserOrder userOrder){
        return client.addDirectUserOrder(userOrder);
    }

    @PostMapping("/addCarOrder")
    @ApiOperation(value = "购物车新增订单",notes = "购物车")
    public Result addCarOrder(@RequestBody Map<String, List<Integer>> map){
        return client.addCarOrder(map);
    }


//    @PostMapping("/initiateGroupPurchase")
//    @ApiOperation(value = "发起拼团")
//    public Result initiateGroupPurchase(@RequestBody GroupPurchaseDto groupPurchaseDto){
//        return client.initiateGroupPurchase(groupPurchaseDto);
//    }

    @DeleteMapping("/delete")
    public Result deleteOrder(@RequestParam("ids") String ids){
        return client.deleteOrder(ids);
    }

    @PostMapping("/getOrderInfo")
    @ApiOperation(value = "获得订单支付信息")
    public Result getOrderDetails(@RequestBody OrderInfoDto orderInfoDto){
        return client.getOrderDetails(orderInfoDto);
    }
    @PostMapping("/commonAddOrder")
    @ApiOperation(value = "新增订单")
    public Result commonAddOrder(@RequestBody CommonOrderDto dto){
        return client.commonAddOrder(dto);
    }

    @PostMapping("/updateorder")
    Result updatebrand(@RequestBody Map updateorder){
        return client.updatebrand(updateorder);
    }

    @ApiOperation(value = "支付宝二维码支付")
    @PostMapping("/QRCode")
    public Result QRCode(@RequestBody Dtsorder dtsorder){
        return client.QRCode(dtsorder);
    }
}
